package com.atwisdom.star.controller.customized;

import com.atwisdom.star.common.vo.JsonResult;
import com.atwisdom.star.common.vo.ResultInfo;
import com.atwisdom.star.core.bsl.customized.ScheduleBusinessBslService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
@Slf4j
@RequestMapping("/scheduleTask")
public class ScheduleTaskController {

    private ScheduleBusinessBslService scheduleBusinessBslService;

    /**
     * @return 返回结果
     * 每隔1分钟执行一次 0 * /1 * * * ?
     * 每天1点执行一次	0 0 1 * * ?
     */
    @GetMapping("/equipmentGuardPlanGet")
    public ResultInfo<?> equipmentGuardPlanGet() {
        log.info("equipmentGuardPlanGet");
        scheduleBusinessBslService.equipmentSchedulePlan();
        return JsonResult.success();
    }

    @PostMapping("/equipmentGuardPlan")
    public ResultInfo<?> equipmentGuardPlan() {
        log.info("equipmentGuardPlan");
        scheduleBusinessBslService.equipmentSchedulePlan();
        return JsonResult.success();
    }

    /**
     * @return 返回结果
     */
    @PostMapping("/changeSupplierPriceStatus")
    public ResultInfo<?> changeSupplierPriceStatus() {
        log.info("runScheduleTask");
        scheduleBusinessBslService.changeSupplierPriceStatus();
        return JsonResult.success();
    }



}
